package top.healthylife.gateway.platform.td.api.api.monitor;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.td.api.utils.TdUtils;
import top.healthylife.gateway.platform.td.dto.monitor.monitordetail.req.TdReqMonitorDetailDto;
import top.healthylife.gateway.platform.td.dto.monitor.monitordetail.res.TdResMonitorDetailDto;

/**
 * @author GaoZeXi
 * @date 2021/7/20 13:19
 */
@Slf4j
@Service
@ApiServiceExplain(price = 20, apiName = "监控详情", info = "个人贷中监控服务是信贷云产品面向信贷机构新增的贷中管理服务，帮助平台对已放款的借款人进行监控， 当借款人在同盾其他合作平台出现逾期记录、新增借贷或者经济法律纠纷时，同盾识别后及时通知平台，帮 助平台提早防范借款人信用恶化风险。")
public class TdMonitorDetailApi implements ParentFace<TdReqMonitorDetailDto, TdResMonitorDetailDto> {

    static String URL = "/postloan/monitor.risk.list/v7";
    static String REQUEST_METHOD = "GET";
    static String DATA = "data";
    @Override
    public TdResMonitorDetailDto execute(TdReqMonitorDetailDto dto) {
        JSONObject jsonObject = TdUtils.tongDunHttpRequest(dto, URL, REQUEST_METHOD);
//        JSONObject data = jsonObject.getJSONObject(DATA);
        return jsonObject.toJavaObject(TdResMonitorDetailDto.class);
    }
}
